<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if (isset($_POST["wijzigen"]))
{
	$nrpl = $_POST["nrpl"];
	$code = $_POST["code"];
	$genre = $_POST["genre"];
	$id = $_POST["id"];
	$sql = "UPDATE `shellkaarten` SET `code`='$code', `genre`='$genre', `nrpl`='$nrpl' WHERE `id` = '$id'";
	echo "SQL: $sql<br>";
	$res = mysql_query($sql, $mysql_id);
	Header( "Location: shll.php" );
	exit();
}
if(isset($_GET["id"]))
{
	
	//echo "<h3>Niveau is nu $_SESSION[login]</h3>";
	if($_SESSION["login"] < 15)
	{	
		$id = $_GET["id"];
		$sql="Select * FROM shellkaarten where id = $id";
		//echo "SQL: $sql<br>";
		$res = mysql_query($sql, $mysql_id);
		while ($row = mysql_fetch_row($res))
		{
			$nrpl = $row[0];
			$code = $row[1];
			$id = $row[2];
			$genre = $row[3];
		}
		?>
		<form action="shellwijzigen.php" method="post">
		<br /><br /><br />
		<table border="1" align="center">
		<tr><td colspan="2" class="delsaux">Cartes Gasoil</td></tr>
		<tr>
		<td><b>Plaque</b></td>
		<td><input type="text" name="nrpl" value="<?php echo $nrpl;?>"></td>
		</tr>
		<tr>
		<td><b>Code</b></td>
		<td><input type="text" name="code" value="<?php echo $code; ?>"></td>
		</tr>
		<tr>
		<td><b>Genre</b></td>
		<td><input type="text" name="genre" value="<?php echo $genre; ?>"></td>
		</tr>
		<input type="hidden" name="id" value="<?php echo $id; ?>">
		<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="wijzigen" value="Modifier"></div></td></tr>
		</form>
		<?php
	} 
	else 
	{
		session_destroy();
		?>
		Vous n'avez pas les droits n&eacute;cessaire pour modifier les donn&eacute;es !
		<?php
	}
}
?>